#include<bits/stdc++.h>
using namespace std;
#define int long long

signed main()
{
	int N, M;
//	vector<int> a;
	cin >> N >> M;
	int sum = 0;
	int cnt = 0;
	int x = 0;
	for (int i = 0; i < N; i++) {
//		cin >> a[i];
		cin >> x;
		sum += x;
		if (sum > M) {
			cnt ++;
			sum = x;
		}
	}
	if (sum != 0) {
		cnt ++;
	}
	cout << cnt << endl;
	return 0;
}
